﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DuelQuizz.contract;
using DuelQuizzServer;
using DuelQuizz.Views;

namespace DuelQuizz
{
    /// <summary>
    /// Interaction logic for LoginUserControl.xaml
    /// </summary>
    public partial class LoginUserControl : UserControl
    {
        public LoginUserControl()
        {
            InitializeComponent();

            
            //a.test();
        }

        private void Button_Click_Login(object sender, RoutedEventArgs e)
        {
            string user = text_user.Text;
            string mdp = text_mdp.Password;

            User log = AppServices.getDuelQuizzServices().login(user, mdp);
            if (log != null)
            {
                MainWindow.changeWindows(new MainPage(log));
            }
            else
            {
                MessageBox.Show("Login ou mot de passe invalide !");
            }
        }

        private void Button_Click_Inscription(object sender, RoutedEventArgs e)
        {
            MainWindow.changeWindows(new AccountCreationUserControl());
        }
    }
}
